package commands.controller;

import dataTypes.DownloadFile;

/**
 * Request to move download in queue - equal to change its priority
 * @author Marcin Kamionowski
 */
public class CC_GUIMoveDownloadTask extends ControllerCommand {

    private final DownloadFile file;
    private final int priority;

    /**
     * Constructor
     * @param file Descriptor of file, which must be moved in queue
     * @param priority New position in queue
     */
    public CC_GUIMoveDownloadTask(DownloadFile file, int priority) {
        super(ControllerCommandType.GUI_MOVE_DOWNLOAD_FILE);
        this.file = file;
        this.priority = priority;
    }

    /**
     * Getter
     * @return Descriptor of file, which must be moved in queue
     */
    public DownloadFile getFile() {
        return file;
    }

    /**
     * Getter
     * @return New position in queue
     */
    public int getPriority() {
        return priority;
    }

    @Override
    public String toString() {
        StringBuilder toStringBuilder = new StringBuilder();
        toStringBuilder.append(super.toString());
        toStringBuilder.append("\n");
        toStringBuilder.append(file.toString());
        toStringBuilder.append("\npriority: ");
        toStringBuilder.append(priority);
        return toStringBuilder.toString();
    }
}
